<?php

function generaMenuJSON($nombd,$nomtaula,$numTaules){

$variable = "[{
    text:'$nombd',
    expanded: true,
    children:[{
";

for($i=0; $i < $numTaules; $i++){
	if($nomtaula[$i] != ""){
		$variable .= "
			text:'$nomtaula[$i]',
			id:'$nomtaula[$i]',
			leaf:true
		},{";
	}
}
$variable = substr ($variable, 0, -3); //eliminem },{ de l'ultim camp

$variable .= "
    }]
	},{
	text:'-Logout-',
	id:'logout',
	icon: 'images/delete.png',
    expanded: true,
	leaf: true
}]
";

return $variable;
}


?>